package yxy.cherry.battle.module.affix.skill;

import yxy.cherry.battle.Battle;
import yxy.cherry.battle.Fighter;
import yxy.cherry.battle.module.affix.AffixContext;
import yxy.cherry.battle.module.affix.AffixContext.AffixTarget;
import yxy.cherry.battle.module.affix.AffixFactory.SkillTypeEnum;
import yxy.cherry.battle.module.affix.Skill;
import yxy.cherry.battle.module.affix.SkillType;
import yxy.cherry.data.bean.skill;

import java.util.ArrayList;

/** 增伤敌阵亡 */
@SkillType(Type = SkillTypeEnum.增伤敌阵亡)
public class Affix_15_增伤敌阵亡 extends Skill {
	// 敌方每有1位武将阵亡，造成的伤害提升

	private int get增伤比例() {
		return getParam(0);
	}

	public Affix_15_增伤敌阵亡(Fighter actor, skill skilldata, int probability, int[] params) {
		super(actor, skilldata, probability, params);
	}

	@Override
	public boolean exec(Fighter actor, Fighter target) {
		int 阵亡数 = 0;
		for (Fighter fighter : actor.getTeam().getTeam对手().getFighters()) {
			if (!fighter.is活着()) {
				阵亡数++;
			}
		}

		AffixContext.AffixAction affixAction = getAffixAction();
		if(target.equals(affixAction.get针对目标())) {
			AffixTarget affixTarget = getAffixAction().getTarget(target);

			ArrayList<Long> 结算伤害流 = genFinalDamage(affixTarget.get伤害流(), affixTarget.getBaseDamageList(), 阵亡数 * get增伤比例());
			Battle.battleLogger(6,"增伤敌阵亡：施法者：" + actor.getName() + "对象：" + affixTarget.get目标().getName() + "阵亡数"+阵亡数+"原始伤害：" + affixTarget.get伤害流().toString() +"基础伤害："+affixTarget.getBaseDamageList().toString()+ "增伤：" + 结算伤害流.toString());
			affixTarget.set伤害流(结算伤害流);
		}

		return true;
	}

}